#ifndef __GLESTextureManager_H__
#define __GLESTextureManager_H__

#include "U2GLESPreRequest.h"
#include "U2TextureManager.h"
#include "U2GLESTexture.h"
#include "U2GLESSupport.h"


U2EG_NAMESPACE_BEGIN


/** GL ES-specific implementation of a U2TextureManager */
class _U2GLESShare U2GLESTextureManager : public U2TextureManager
{
public:
    U2GLESTextureManager(U2GLESSupport& support);
    virtual ~U2GLESTextureManager();

    GLuint getWarningTextureID() { return mWarningTextureID; }

    /// @copydoc U2TextureManager::getNativeFormat
    PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage);

    /// @copydoc U2TextureManager::isHardwareFilteringSupported
    bool isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage,
                                      bool preciseFormatOnly = false);

protected:
    /// @copydoc ResourceManager::createImpl
    U2Resource* createImpl(const U2String& name, U2ResourceHandle handle,
                         const U2String& group, bool isManual, U2ManualResourceLoader* loader, 
                         const NameValuePairList* createParams);
    
    /// Internal method to create a warning texture (bound when a texture unit is blank)
    void createWarningTexture();

protected:
    
    U2GLESSupport& mGLSupport;
    GLuint mWarningTextureID;
};


U2EG_NAMESPACE_END


#endif
